package com.ctech.wsgen.model;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class ItemCategory extends Item implements Comparable<ItemCategory> {

	private String catTitleName;
	private String groupName;
	private List<Item> items = new ArrayList<Item>();
	
	public ItemCategory(int id, String vendorName, String partNum,
			String description, BigDecimal price, String fileName, String catTitleName, String groupName) {
		super(id, vendorName, partNum, description, price, fileName);
		this.catTitleName = catTitleName;
		this.groupName = groupName;
	}

	public List<Item> getItems() {
		return items;
	}
	public void setItems(List<Item> items) {
		this.items = items;
	}

	public void setCatTitleName(String catTitleName) {
		this.catTitleName = catTitleName;
	}

	public String getCatTitleName() {
		return catTitleName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public String getGroupName() {
		return groupName;
	}

	public String getUniqueName() {
		return getCatTitleName() + "-" + getFileName();
	}

	public int compareTo(ItemCategory o) {
        int lastCmp = groupName.compareTo(o.groupName);
        return (lastCmp != 0 ? lastCmp :
                catTitleName.compareTo(o.catTitleName));
	}

}
